package com.game.majiang.vo;

import java.sql.Types;
import java.util.ArrayList;

import javax.sql.rowset.CachedRowSet;

import com.game.server.db.Parameter;
import com.game.server.db.ParameterType;
import com.game.server.db.SqlHelperwrite;
import com.game.server.message.proto.out.awards;

import lombok.Data;

@Data
public class AwardsLogVo {
	int uid;
	int tableid;
	int shou;
	int gamechang;
	int roomtype;
	String neirong;
	
	public  void insetAwardsLoVo()
	{
		String cmdText = "insert into zhongjianglog(uid,tableid,shou,gamechang,roomtype,neirong,createtime)values(?,?,?,?,?,?,now())";
		Parameter p1 = new Parameter(Types.INTEGER, uid, ParameterType.Input);
		Parameter p2 = new Parameter(Types.INTEGER, tableid, ParameterType.Input);
		Parameter p3 = new Parameter(Types.INTEGER, shou, ParameterType.Input);
		Parameter p4 = new Parameter(Types.INTEGER, gamechang, ParameterType.Input);
		Parameter p5 = new Parameter(Types.INTEGER, roomtype, ParameterType.Input);
		Parameter p6 = new Parameter(Types.VARCHAR, neirong, ParameterType.Input);
		SqlHelperwrite.execute(cmdText,p1,p2,p3,p4,p5,p6);
	}
	
	
	public static ArrayList<awards> SelectAwardslog(int tableid) {
		ArrayList<awards> list=new ArrayList<awards>();
		String cmdText = "select uid,tableid,shou,gamechang,roomtype,neirong,createtime from zhongjianglog where  tableid="+tableid+" ";
		CachedRowSet rs = SqlHelperwrite.getResultSet(cmdText);
		try {
			while (rs.next()) {
				awards a=new awards();
				a.setUid(rs.getInt(1));
				a.setTableid(rs.getInt(2));
				a.setShou(rs.getInt(3));
				a.setGamechang(rs.getInt(4));
				a.setRoomtype(rs.getInt(5));
				a.setNeirong(rs.getString(6));
				a.setTime(rs.getString(7));
				list.add(a);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
	
	
}
